package com.dapeng.cleardatabackend.utils;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.QuoteMode;

/**
 * @author dapeng
 * @description csv文件util
 * @date 2024/12/23 16:05
 */
public class CsvUtils {
    public static CSVFormat getCsvFormat(String delimiter) {
        return CSVFormat.Builder.create()
                .setDelimiter(delimiter.charAt(0))
                .setTrim(true)
                .setQuote('"')
                .setQuoteMode(QuoteMode.MINIMAL)
                .setSkipHeaderRecord(false)
                .setIgnoreEmptyLines(true)
                .setIgnoreSurroundingSpaces(true)
                .setCommentMarker('#')
                .build();
    }
}
